<template>
	<div class="model">
		<h2 class="model__title">商家审核详情<span @click="close" class="model__title--close">&times;</span></h2>
		<div class="model__content" v-loading="loading">
			<div v-if="company">
				<div class="item" v-if="company.aggainst_reason">
					<h2 class="item__title item__title-warning" style="color: #f20;">驳回理由</h2>
					<div class="item__reason">
						{{company.aggainst_reason}}
					</div>
				</div>
				<div v-if="company.bussiness_info">
					<div class="item">
						<h2 class="item__title">企业基本信息</h2>
						<div class="item__detail">
							<span class="item__detail--title">企业名称:</span>
							<span class="item__detail--value">{{company.bussiness_info.enterprise_name}}</span>
						</div>
						<div class="item__detail">
							<span class="item__detail--title">单位所在地:</span>
							<span class="item__detail--value">{{company.bussiness_info.bussiness_area}}</span>
						</div>
						<div class="item__detail">
							<span class="item__detail--title">企业类型:</span>
							<span class="item__detail--value">{{company.bussiness_info.company_type}}</span>
						</div>
						<div class="item__detail">
							<span class="item__detail--title">营业期限:</span>
							<span class="item__detail--value">{{company.bussiness_info.business_term}}</span>
						</div>
						<div class="item__detail">
							<span  class="item__detail--title">注册资本:</span>
							<span class="item__detail--value">{{company.bussiness_info.regist_money}}</span>
						</div class="item__detail">
						<div class="item__detail">
							<span  class="item__detail--title">证件类型:</span>
							<span class="item__detail--value">{{company.bussiness_info.certificate_type}}</span>
						</div>
						<div  class="item__detail item__detail-block">
							<span  class="item__detail--title">经营范围:</span>
							<span class="item__detail--value">{{company.bussiness_info.manage_circle}}</span>
						</div>
					</div>
					<div class="item">
						<h2 class="item__title">法人信息</h2>
						<div class="item-detail">
							<div class="item__detail">
								<span  class="item__detail--title">法人姓名:</span>
								<span class="item__detail--value">{{company.bussiness_info.legal_man_name}}</span>
							</div>
							<div class="item__detail">
								<span  class="item__detail--title">法人身份证号:</span>
								<span class="item__detail--value">{{company.bussiness_info.legal_man_idno}}</span>
							</div>
							<div class="item__detail">
								<span  class="item__detail--title">法定代表人归属地:</span>
								<span class="item__detail--value">{{company.bussiness_info.legal_man_area}}</span>
							</div>
							<div class="item__detail">
								<span  class="item__detail--title">填写人身份:</span>
								<span class="item__detail--value">{{company.bussiness_info.write_identity}}</span>
							</div>
							<div class="item__detail">
								<span  class="item__detail--title">法人证件有效期:</span>
								<span class="item__detail--value">{{company.bussiness_info.legal_man_days}}</span>
							</div>
						</div>
					</div>
					<div class="item">
						<h2 class="item__title">银行卡信息</h2>
						<div class="item-detail" v-if="company.bank_card">
							<div class="item__detail">
								<span  class="item__detail--title">账户类型:</span>
								<span class="item__detail--value">{{company.bank_card.bank_card_type}}</span>
							</div>
							<div class="item__detail">
								<span  class="item__detail--title">银行开户名:</span>
								<span class="item__detail--value">{{company.bank_card.bank_card_name}}</span>
							</div>
							<div class="item__detail">
								<span  class="item__detail--title">银行卡号:</span>
								<span class="item__detail--value">{{company.bank_card.card_no}}</span>
							</div>
							<div class="item__detail">
								<span  class="item__detail--title">开户总行:</span>
								<span class="item__detail--value">{{company.bank_card.bank}}</span>
							</div>
							<div class="item__detail">
								<span  class="item__detail--title">开户支行:</span>
								<span class="item__detail--value">{{company.bank_card.bank_name}}</span>
							</div>
						</div>
					</div>
				</div>
				<div class="item">
					<h2 class="item__title">商家基本信息</h2>
					<div class="item-detail">
						<div class="item__detail">
							<span  class="item__detail--title">商家名:</span>
							<span class="item__detail--value">{{company.company_name}}</span>
						</div>
						<div class="item__detail">
							<span  class="item__detail--title">注册时间:</span>
							<span class="item__detail--value">{{company.regist_time | formatTime}}</span>
						</div>
						<div class="item__detail item__detail-block">
							<span  class="item__detail--title">商家地址:</span>
							<span class="item__detail--value">{{company.address}}</span>
						</div>
						<div class="item__detail item__detail-block">
							<span  class="item__detail--title">商家简介:</span>
							<span class="item__detail--value">{{company.introduce}}</span>
						</div>
					</div>
				</div>
				<div class="item">
					<h2 class="item__title">推荐人信息</h2>
					<div v-if="company.company_spreader">
						<div class="item__detail">
							<span class="item__detail--title">姓名:</span>
							<span class="item__detail--value">{{company.company_spreader.real_name}}</span>
						</div>
						<div class="item__detail">
							<span class="item__detail--title">身份证号:</span>
							<span class="item__detail--value">{{company.company_spreader.id_no}}</span>
						</div>
						<div class="item__detail">
							<span class="item__detail--title">手机号:</span>
							<span class="item__detail--value">{{company.company_spreader.mobile}}</span>
						</div>
					</div>
					<div v-else>
						无
					</div>
				</div>
				<div class="item">
					<h2 class="item__title">商家logo</h2>
					<div v-if="company.logo">
						<img :src="company.logo.thump+'400'" alt="" class="item__pic--img" @click="showBigImg(company.logo.url)"/>
					</div>
					<div v-else>无</div>
				</div>
				<div class="item">
					<h2 class="item__title">营业执照</h2>
					<div v-if="company.bussiness_img">
						<img :src="company.bussiness_img.thump+'400'" alt="" class="item__pic--img" @click="showBigImg(company.bussiness_img.url)"/>
					</div>
					<div v-else>无</div>
				</div>
				<div class="item">
					<h2 class="item__title">法人身份证</h2>
					<div v-if="company.idno1 && company.idno2">
						<img :src="company.idno1.thump+'400'" alt="" class="item__pic--img" @click="showBigImg(company.idno1.url)"/>
						<img :src="company.idno2.thump+'400'" alt="" class="item__pic--img" @click="showBigImg(company.idno2.url)"/>
					</div>
					<div v-else>无</div>
				</div>
				<div class="item">
					<h2 class="item__title">组织机构代码证</h2>
					<div v-if="company.organize_img">
						<img :src="company.organize_img.thump+'400'" alt="" class="item__pic--img" @click="showBigImg(company.organize_img.url)"/>
					</div>
					<div v-else>无</div>
				</div>
				<div class="item">
					<h2 class="item__title">代理人身份证</h2>
					<div v-if="company.agent_man_idno1 && company.agent_man_idno2">
						<img :src="company.agent_man_idno1.thump+'400'" alt="" class="item__pic--img" @click="showBigImg(company.agent_man_idno1.url)"/>
						<img :src="company.agent_man_idno2.thump+'400'" alt="" class="item__pic--img" @click="showBigImg(company.agent_man_idno2.url)"/>
					</div>
					<div v-else>无</div>
				</div>
				<div class="item">
					<h2 class="item__title">法人授权书</h2>
					<div v-if="company.cert_auth_img">
						<img :src="company.cert_auth_img.thump+'400'" alt="" class="item__pic--img" @click="showBigImg(company.cert_auth_img.url)"/>
					</div>
					<div v-else>无</div>
				</div>
				<div class="item">
					<h2 class="item__title">店铺展示图</h2>
					<div v-if="company.show_imgs && company.show_imgs.length">
						<img v-for="img in company.show_imgs" :src="img.thump+'400'" alt="" class="item__pic--img" @click="showBigImg(img.url)"/>
					</div>
					<div v-else>无</div>
				</div>
			</div>
			<big-img v-if="isShowBigImg" :imgUrl="bigImgUrl"></big-img>
		</div>
	</div>
</template>

<script>
	import big_img from "../../../components/big_img.vue"
	export default {
		created(){
			this.fetchCompany();
		},
		components: {
			"big-img": big_img,
		},
		props: ["id"],
		data() {
			return {
				loading: true,
				bigImgUrl: null,
				isShowBigImg: false,
				company: {
					bussiness_info: {}
				}
			}
		},
		methods: {
			showBigImg(imgUrl) {
				this.bigImgUrl = imgUrl;
				this.isShowBigImg = true;
			},
			close() {
				this.$parent.showModel = false;
			},
			fetchCompany() {
				this.loading = true;
				var url = `${this.url}/company/check_get_detail.action`;
				var params = {
					company_check_id: this.id
				};
				this.$http.get(url,{ params }).then((res)=> {
					this.loading = false;
					if( res.data.success ) {
						this.company = res.data.result;
					}else {
						this.$message({
							type: "error",
							message: res.data.result.errmsg
						});
					}
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
.item__pic--img {
	max-width: 200px;
	max-height: 200px;
}
</style>